import asyncio
import aiohttp
import time

url = "http://69.231.135.101/pgktstudent/studentCourseHomework/getAnswer"
headers = {
    "Accept": "application/json, text/plain, */*",
    "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
    "Authorization": "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImM5NDNmOGQwLWEwY2MtNDRkNi05Y2E4LWQzODM0ODk4M2YwYSJ9.mOpszL8HEPHnz7hMIiNR04AaL7EJCdVwV3VkHbKgXNsmgUjJ0-DIZ4WmDkoHl6FoPWXCuuJUDN4UmvtsNcShAw",
    "Content-Type": "application/json",
    "Origin": "http://69.231.135.101",
    "Proxy-Connection": "keep-alive",
    "Referer": "http://69.231.135.101/pgktjwsnew/",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0"
}
data = {
    "id": "0028bb2835244a7aa2ae64f83c171e68",
    "choose": "A"
}

async def send_request(session, idx):
    try:
        async with session.post(url, headers=headers, json=data, ssl=False) as resp:
            text = await resp.text()
            print(f"[{idx}] Status: {resp.status}, Response: {text}")
    except Exception as e:
        print(f"[{idx}] Error: {e}")

async def main():
    async with aiohttp.ClientSession() as session:
        tasks = [send_request(session, i) for i in range(50)]  # 并发50个
        await asyncio.gather(*tasks)

if __name__ == "__main__":
    # count_cycle= 0
    # while count_cycle < 58:
    #     asyncio.run(main())
    #     count_cycle += 1
    #     time.sleep(1)
    asyncio.run(main())